<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript" src="<c:url value='/js/jquery-1.8.3.min.js'/>"></script>
<title>密码重置</title>
</head>
<body>
	<form action="" method="post" onsubmit="return false;">
		邮&nbsp;箱：<input id="email" type="text" name="email" value=""/><br>
		验证码： <input type="text" name="verifycode" value=""> 
		<a href="" id="btn" onclick="return false;">获取验证码</a><br>
		新密码：<input type="password" name="password" value=""><br> 
		<input id="submitBtn" type="submit" value="提交">
	</form>
	<script type="text/javascript">
		$("#btn").click(function() {
			email = $("#email").val();
			$.ajax({
				url:'<c:url value="/email"/>',
				type:'POST',
				data:'email='+ email,
				dataType:'json',
				success:function(data) {
					alert(data.result);
				}
			});
		});
		$("#submitBtn").click(function() {
			_data = $("form").serialize();
			$.ajax({
				url:'<c:url value="/resetPwd"/>',
				type:'POST',
				data: _data,
				dataType:'json',
				success:function(data) {
					alert(data.result);
					//五秒后跳转至登录界面
					setTimeout(function() {
						location.href="<c:url value='/'/>";
					}, 5000);
					
				}
			});
		});
	</script>
</body>
</html>